﻿using System;
using System.Web;
using System.Web.UI;
using System.Data;
using System.IO;
using QualityRpt.Service;
using QualityRpt.Utils;

namespace QualityRPT
{
	
	public partial class JztbgQuery : System.Web.UI.Page
	{
		protected void Page_Load(object sender, EventArgs e){
			if (!this.IsPostBack) {
				DateTime startTime = DateTime.Now.AddDays (-7);
				this.textBoxStart.Text = startTime.ToString ("yyyy-MM-dd");
				this.textBoxEnd.Text = DateTime.Now.ToString ("yyyy-MM-dd");
			} else {
				startTime = DateTime.Parse (textBoxStart.Text);
				endTime = DateTime.Parse (textBoxEnd.Text);
			}
		}
		DateTime startTime;DateTime endTime;
		protected void ButtonQ_Click(object sender, EventArgs e){
			DataTable table = TransNoteService.GetJZTB (startTime, endTime);
			this.repeater_data.DataSource = table;
			this.repeater_data.DataBind ();
		}
		protected void ButtonExport_Click(object sender, EventArgs e){
			DataTable table = TransNoteService.GetJZTB (startTime, endTime);
			string strTemFile = Server.MapPath ("~/") + "/ReportTemplate/军车统计模板.xls";
			MemoryStream ms = ExcelUtils.RenderToExcelMs (table, strTemFile, null, 2, true, 0);
			ExcelUtils.RenderToBrowser (ms,this.Context, "军车统计"+DateTime.Now.ToString("yyyyMMdd")+".xls");	

		}
		protected void ButtonExportDetail_Click(object sender, EventArgs e){

		}
	}
}

